import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 配置路由
    {
      path: '/',
      name: 'index',
      component: () => import('@/views/index.vue'),
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('@/views/home/index.vue')
        },
        {
          path: '/consult',
          name: 'consult',
          component: () => import('@/views/consult/index.vue')
        },
        {
          path: '/video',
          name: 'video',
          component: () => import('@/views/video/index.vue')
        },
        {
          path: '/handpick',
          name: 'handpick',
          component: () => import('@/views/handpick/index.vue')
        },
        {
          path: '/profile',
          name: 'profile',
          component: () => import('@/views/profile/index.vue')
        },
        {
          path: '/QA',
          name: 'QA',
          component: () => import('@/views/QA/index.vue')
        },
        {
          path:'/doctor',
          name:'doctor',
          component:()=>import('@/views/QA/doctor.vue')
        },
        {
          path: '/feedback',
          name: 'feedback',
          component: () => import('@/views/feedback/index.vue'),
        },
        {
          path:'/myFeedback',
          name:'myFeedback',
          component:()=>import('@/views/feedback/myFeedback.vue')
        },
        {
          path: '/detail',
          name: 'detail',
          component: () => import('@/views/detail/index.vue')
        },
        {
          path: '/pay',
          name: 'pay',
          component: () => import('@/views/pay/index.vue')
        },
        {
          path: '/cart',
          name: 'cart',
          component: () => import('@/views/cart/index.vue')
        },
        {
          path:'/goods',
          name:'goods',
          component:()=>import('@/views/goods/index.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue')
    },
    {
      path: '/:catchAll(.*)', //匹配所有路径
      component: () => import('@/views/404.vue')
    }
  ]
})

export default router
